package com.bricker.laboratorymanagement.business.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bricker.laboratorymanagement.business.entity.SysGroup;
import com.bricker.laboratorymanagement.business.model.GroupSelectModel;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface SysGroupMapper extends BaseMapper<SysGroup> {

    public List<SysGroup> getSysGroup(Page page, @Param("groupSelectModel") GroupSelectModel groupSelectModel);

    @Select("select  t1.id as id,\n" +
            "        t1.name as name,\n" +
            "        t1.user_ids as userIds,\n" +
            "        t1.size as size,\n" +
            "        t1.ex_id as exId,\n" +
            "        t1.declaration as declaration,\n" +
            "\t\t\t\tt1.CREATED_BY as createdBy,\n" +
            "        t1.CREATED_TIME as createdTime,\n" +
            "        t1.UPDATED_BY as updatedBy,\n" +
            "        t1.UPDATED_TIME as updatedTime,\n" +
            "        t1.del_flag as delFlag,\n" +
            "\t\t\t\tt2.nick_name as createByName\n" +
            "\t\t\t\tfrom sys_group t1\n" +
            "\t\t\t\tLEFT JOIN sys_user t2\n" +
            "\t\t\t\ton t1.CREATED_BY =t2.id\n" +
            "\t\t\t\twhere t1.id=#{id}")
    public SysGroup getMySysGroup(@Param("id")Long id);
}